//
//  TimerHolder.h
//  yixin_iphone
//  
//  Created by lwc on 14-3-14.
//  Copyright (c) 2013年 Netease. All rights reserved.
//

//TimerHolder，管理某个Timer，功能为
//1.防止Timer retain某个VC导致这个VC的dealloc延迟 甚至不执行
//2.添加自动invalidate前一个Timer的功能 (每个TimerHolder都只有一个Timer)
//3.需要在不使用这个timer的时候设置delegate为nil，如果是repeat的timer还需要stopTime

#import <Foundation/Foundation.h>

@class TimerHolder;

@protocol TimerHolderDelegate <NSObject>
- (void)onTimerHolderFire: (TimerHolder *)holder;
@end


@interface TimerHolder : NSObject
@property (nonatomic,weak)    id<TimerHolderDelegate> delegate;

- (void)startTimer: (NSTimeInterval)seconds
          delegate: (id<TimerHolderDelegate>)timerHolderDelegate
           repeats: (BOOL)repeats;

- (void)stopTimer;

@end
